"use strict";
const path = require("path");
const fs = require("fs");
module.exports = (app) => {
  const exports = {};

  exports.sequelize = {
    dialect: "mysql", // support: mysql, mariadb, postgres, mssql
    database: "library",
    host: "127.0.0.1",
    port: 3306,
    username: "root",
    password: "291823ysj",
  };

  exports.bodyParser = {
    jsonLimit: '60mb',
    formLimit: '60mb',
  };

  exports.siteFile = {
    "/favicon.jpg": fs.readFileSync(
      path.join(app.baseDir, "app/web/asset/images/favicon.jpg")
    ),
  };

  exports.vuessr = {
    layout: path.join(app.baseDir, "app/web/view/layout.html"),
  };

  exports.logger = {
    consoleLevel: "DEBUG",
    dir: path.join(app.baseDir, "logs"),
  };

  exports.static = {
    prefix: "/public/",
    dir: [path.join(app.baseDir, 'public'), path.join(app.baseDir, 'imageRec')],
  };

  exports.multipart = {
    fileExtensions: ['.gif','.jpg','.png','.jpeg'],
    whitelist: ['.gif','.jpg','.png','.jpeg'],
    fields: 50,//表单上传字段限制的个数
    fileSize: '5mb',//文件上传的大小限制
  };

  exports.keys = "123456";

  exports.middleware = ["locals", "access", "verified","errorHandler"];

  exports.security = {
    csrf: {
      enable: false,
    },
    xframe: {
      enable: false,
    },
  };
  return exports;
};
